#include<stdio.h>
int main()
{
	int m=0,n=0;
	scanf_s("%d%d", &m, &n);
	int arr1[20][20] = { 0 };
	int arr2[20][20] = { 0 };
	int arr3[20][20] = { 0 };
	int i, j;
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < n; j++)
		{
			scanf_s("%d", &arr1[i][j]);
		}
	}
	for (i = 0; i < n; i++)
	{
		for (j = 0; j < m; j++)
		{
			scanf_s("%d", &arr2[i][j]);
		}
	}
	i = 0; j = 0; int a = 0, b = 0, c = 0, d = 0;
	for (a = 0; a < m; a++)
	{
		for (b = 0; b < n; b++)
		{
			arr3[i][j] += arr1[a][b] * arr2[c][d]; c++;
			if (b == n - 1)
			{
				b = -1; d++; c = 0;
				j++;
			}
			if (j == m)
			{
				break;
			}
		}
		i++; j = 0; d = 0;
	}
	for (i = 0; i < m; i++)
	{
		for (j = 0; j < m; j++)
		{
			printf("%d ", arr3[i][j]);
		}
		printf("\n");
	}
	return 0;
}